\(\int \frac {\cot ^2(d (a+b \log (c x^n)))}{x} \, dx\) [220]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [F(-1)]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 30 \[ \int \frac {\cot ^2\left (d \left (a+b \log \left (c x^n\right )\right )\right )}{x} \, dx=-\frac {\cot \left (a d+b d \log \left (c x^n\right )\right )}{b d n}-\log (x) \]

[Out]

-cot(a*d+b*d*ln(c*x^n))/b/d/n-ln(x)

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.105, Rules used = {3554, 8} \[ \int \frac {\cot ^2\left (d \left (a+b \log \left (c x^n\right )\right )\right )}{x} \, dx=-\frac {\cot \left (a d+b d \log \left (c x^n\right )\right )}{b d n}-\log (x) \]

[In]

Int[Cot[d*(a + b*Log[c*x^n])]^2/x,x]

[Out]

-(Cot[a*d + b*d*Log[c*x^n]]/(b*d*n)) - Log[x]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \cot ^2(d (a+b x)) \, dx,x,\log \left (c x^n\right )\right )}{n} \\ & = -\frac {\cot \left (a d+b d \log \left (c x^n\right )\right )}{b d n}-\frac {\text {Subst}\left (\int 1 \, dx,x,\log \left (c x^n\right )\right )}{n} \\ & = -\frac {\cot \left (a d+b d \log \left (c x^n\right )\right )}{b d n}-\log (x) \\ \end{align*}

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.

Time = 0.10 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.70 \[ \int \frac {\cot ^2\left (d \left (a+b \log \left (c x^n\right )\right )\right )}{x} \, dx=-\frac {\cot \left (a d+b d \log \left (c x^n\right )\right ) \operatorname {Hypergeometric2F1}\left (-\frac {1}{2},1,\frac {1}{2},-\tan ^2\left (a d+b d \log \left (c x^n\right )\right )\right )}{b d n} \]

[In]

Integrate[Cot[d*(a + b*Log[c*x^n])]^2/x,x]

[Out]

-((Cot[a*d + b*d*Log[c*x^n]]*Hypergeometric2F1[-1/2, 1, 1/2, -Tan[a*d + b*d*Log[c*x^n]]^2])/(b*d*n))

Maple [A] (verified)

Time = 0.32 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.53

method result size
derivativedivides \(\frac {-\cot \left (d \left (a +b \ln \left (c \,x^{n}\right )\right )\right )+\frac {\pi }{2}-\operatorname {arccot}\left (\cot \left (d \left (a +b \ln \left (c \,x^{n}\right )\right )\right )\right )}{n b d}\) \(46\)
default \(\frac {-\cot \left (d \left (a +b \ln \left (c \,x^{n}\right )\right )\right )+\frac {\pi }{2}-\operatorname {arccot}\left (\cot \left (d \left (a +b \ln \left (c \,x^{n}\right )\right )\right )\right )}{n b d}\) \(46\)
parallelrisch \(\frac {-1-\ln \left (x \right ) b d n \tan \left (d \left (a +b \ln \left (c \,x^{n}\right )\right )\right )}{b d n \tan \left (d \left (a +b \ln \left (c \,x^{n}\right )\right )\right )}\) \(48\)
risch \(-\ln \left (x \right )-\frac {2 i}{d b n \left (\left (x^{n}\right )^{2 i b d} c^{2 i b d} {\mathrm e}^{d \left (-b \pi \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}+b \pi \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right ) \operatorname {csgn}\left (i c \right )+b \pi \operatorname {csgn}\left (i c \,x^{n}\right )^{3}-b \pi \operatorname {csgn}\left (i c \,x^{n}\right )^{2} \operatorname {csgn}\left (i c \right )+2 i a \right )}-1\right )}\) \(127\)

[In]

int(cot(d*(a+b*ln(c*x^n)))^2/x,x,method=_RETURNVERBOSE)

[Out]

1/n/b/d*(-cot(d*(a+b*ln(c*x^n)))+1/2*Pi-arccot(cot(d*(a+b*ln(c*x^n)))))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 78 vs. \(2 (30) = 60\).

Time = 0.24 (sec) , antiderivative size = 78, normalized size of antiderivative = 2.60 \[ \int \frac {\cot ^2\left (d \left (a+b \log \left (c x^n\right )\right )\right )}{x} \, dx=-\frac {b d n \log \left (x\right ) \sin \left (2 \, b d n \log \left (x\right ) + 2 \, b d \log \left (c\right ) + 2 \, a d\right ) + \cos \left (2 \, b d n \log \left (x\right ) + 2 \, b d \log \left (c\right ) + 2 \, a d\right ) + 1}{b d n \sin \left (2 \, b d n \log \left (x\right ) + 2 \, b d \log \left (c\right ) + 2 \, a d\right )} \]

[In]

integrate(cot(d*(a+b*log(c*x^n)))^2/x,x, algorithm="fricas")

[Out]

-(b*d*n*log(x)*sin(2*b*d*n*log(x) + 2*b*d*log(c) + 2*a*d) + cos(2*b*d*n*log(x) + 2*b*d*log(c) + 2*a*d) + 1)/(b
*d*n*sin(2*b*d*n*log(x) + 2*b*d*log(c) + 2*a*d))

Sympy [F]

\[ \int \frac {\cot ^2\left (d \left (a+b \log \left (c x^n\right )\right )\right )}{x} \, dx=\int \frac {\cot ^{2}{\left (a d + b d \log {\left (c x^{n} \right )} \right )}}{x}\, dx \]

[In]

integrate(cot(d*(a+b*ln(c*x**n)))**2/x,x)

[Out]

Integral(cot(a*d + b*d*log(c*x**n))**2/x, x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 322 vs. \(2 (30) = 60\).

Time = 0.21 (sec) , antiderivative size = 322, normalized size of antiderivative = 10.73 \[ \int \frac {\cot ^2\left (d \left (a+b \log \left (c x^n\right )\right )\right )}{x} \, dx=\frac {{\left (b d \cos \left (2 \, b d \log \left (c\right )\right )^{2} + b d \sin \left (2 \, b d \log \left (c\right )\right )^{2}\right )} n \cos \left (2 \, b d \log \left (x^{n}\right ) + 2 \, a d\right )^{2} \log \left (x\right ) + {\left (b d \cos \left (2 \, b d \log \left (c\right )\right )^{2} + b d \sin \left (2 \, b d \log \left (c\right )\right )^{2}\right )} n \log \left (x\right ) \sin \left (2 \, b d \log \left (x^{n}\right ) + 2 \, a d\right )^{2} + b d n \log \left (x\right ) - 2 \, {\left (b d n \cos \left (2 \, b d \log \left (c\right )\right ) \log \left (x\right ) - \sin \left (2 \, b d \log \left (c\right )\right )\right )} \cos \left (2 \, b d \log \left (x^{n}\right ) + 2 \, a d\right ) + 2 \, {\left (b d n \log \left (x\right ) \sin \left (2 \, b d \log \left (c\right )\right ) + \cos \left (2 \, b d \log \left (c\right )\right )\right )} \sin \left (2 \, b d \log \left (x^{n}\right ) + 2 \, a d\right )}{2 \, b d n \cos \left (2 \, b d \log \left (c\right )\right ) \cos \left (2 \, b d \log \left (x^{n}\right ) + 2 \, a d\right ) - 2 \, b d n \sin \left (2 \, b d \log \left (c\right )\right ) \sin \left (2 \, b d \log \left (x^{n}\right ) + 2 \, a d\right ) - {\left (b d \cos \left (2 \, b d \log \left (c\right )\right )^{2} + b d \sin \left (2 \, b d \log \left (c\right )\right )^{2}\right )} n \cos \left (2 \, b d \log \left (x^{n}\right ) + 2 \, a d\right )^{2} - {\left (b d \cos \left (2 \, b d \log \left (c\right )\right )^{2} + b d \sin \left (2 \, b d \log \left (c\right )\right )^{2}\right )} n \sin \left (2 \, b d \log \left (x^{n}\right ) + 2 \, a d\right )^{2} - b d n} \]

[In]

integrate(cot(d*(a+b*log(c*x^n)))^2/x,x, algorithm="maxima")

[Out]

((b*d*cos(2*b*d*log(c))^2 + b*d*sin(2*b*d*log(c))^2)*n*cos(2*b*d*log(x^n) + 2*a*d)^2*log(x) + (b*d*cos(2*b*d*l
og(c))^2 + b*d*sin(2*b*d*log(c))^2)*n*log(x)*sin(2*b*d*log(x^n) + 2*a*d)^2 + b*d*n*log(x) - 2*(b*d*n*cos(2*b*d
*log(c))*log(x) - sin(2*b*d*log(c)))*cos(2*b*d*log(x^n) + 2*a*d) + 2*(b*d*n*log(x)*sin(2*b*d*log(c)) + cos(2*b
*d*log(c)))*sin(2*b*d*log(x^n) + 2*a*d))/(2*b*d*n*cos(2*b*d*log(c))*cos(2*b*d*log(x^n) + 2*a*d) - 2*b*d*n*sin(
2*b*d*log(c))*sin(2*b*d*log(x^n) + 2*a*d) - (b*d*cos(2*b*d*log(c))^2 + b*d*sin(2*b*d*log(c))^2)*n*cos(2*b*d*lo
g(x^n) + 2*a*d)^2 - (b*d*cos(2*b*d*log(c))^2 + b*d*sin(2*b*d*log(c))^2)*n*sin(2*b*d*log(x^n) + 2*a*d)^2 - b*d*
n)

Giac [F(-1)]

Timed out. \[ \int \frac {\cot ^2\left (d \left (a+b \log \left (c x^n\right )\right )\right )}{x} \, dx=\text {Timed out} \]

[In]

integrate(cot(d*(a+b*log(c*x^n)))^2/x,x, algorithm="giac")

[Out]

Timed out

Mupad [B] (verification not implemented)

Time = 27.93 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.30 \[ \int \frac {\cot ^2\left (d \left (a+b \log \left (c x^n\right )\right )\right )}{x} \, dx=-\ln \left (x\right )-\frac {2{}\mathrm {i}}{b\,d\,n\,\left ({\mathrm {e}}^{a\,d\,2{}\mathrm {i}}\,{\left (c\,x^n\right )}^{b\,d\,2{}\mathrm {i}}-1\right )} \]

[In]

int(cot(d*(a + b*log(c*x^n)))^2/x,x)

[Out]

- log(x) - 2i/(b*d*n*(exp(a*d*2i)*(c*x^n)^(b*d*2i) - 1))